Skip to content

fix: Test manifest to respect parameterized tests - #15825

Closed
PragTob wants to merge 1 commit into
elixir-lang:mainfrom
PragTob:exunit-paramaterized-test-rerun
Closed

fix: Test manifest to respect parameterized tests#15825
PragTob wants to merge 1 commit into
elixir-lang:mainfrom
PragTob:exunit-paramaterized-test-rerun

Conversation

@PragTob

@PragTob PragTob commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Fixes #15820

In short, parameterized tests weren't accounted for in the test manifest, so if a variant first failed it could get overridden by a later run with different parameters as the key was just {module, test}.
So, this PR introduces the {module, test, parameters} variant, to account for it.

The old {module, test} is still supported instead of making it {module, test, %{}} as it is part of the official documentation (:only_test_ids) and so we don't want to break compatibility.

Decisions

Some may be worth revisiting:

  • bumped the manifest version as we changed it
  • decided to support both {module, test} and {module, test, parameters} (see above) but we could also transform it at the boundary (i.e. transform {module, test} input to {module, test, %{}}) and then have a more uniform manifest (and less branching code paths)

Potential Problems

  • I believe right now if a parameter gets deleted from a test, a corresponding failure may not be pruned from the manifest as we don't get that data (it's not part of the loaded test module), so then mix test --failed would run but not find any test. Not sure how to best fix that.

Fixes elixir-lang#15820

In short, parameterized tests weren't accounted for in the test
manifest, so if a variant first failed it could get overridden
by a later run with different parameters as the key was just
`{module, test}`.
So, this PR introduces the `{module, test, parameters}` variant,
to account for it.

The old `{module, test}` is still supported instead of making it
`{module, test, %{}}` as it is part of the official documentation
(`:only_test_ids`) and so we don't want to break compatibility.

## Decisions

Some may be worth revisiting:

* bumped the manifest version as we changed it
* decided to support both `{module, test}` and `{module, test, parameters}`
(see above) but we could also transform it at the boundary (i.e. transform
`{module, test}` input to `{module, test, %{}}`) and then have a more
uniform manifest (and less branching code paths)

## Potential Problems

* I believe right now if a parameter gets deleted from a test,
a corresponding failure may not be pruned from the manifest as
we don't get that data (it's not part of the loaded test module), so
then `mix test --failed` would run but not find any test. Not
sure how to best fix that.
@josevalim

Copy link
Copy Markdown
Member

Thank you @PragTob!

I think there is another solution here which is to, in case of parameterized tests, we only write it as passing if all parameters succeed. This way we don't need to change the test ids representation and we always run all parameters for the failing test (which is quite reasonable). WDYT? Perhaps worth trying in another PR?

@PragTob

PragTob commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

@josevalim 👋

Of course, that's a very wonderful idea which would avoid us having to change the manifest! I like the simplicity, thank you!

I'll wip that up later today/tomorrow and we can check then :)

IMG_20190611_082753_Bokeh

@PragTob

PragTob commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Alternative approach is up at #15831 !

@josevalim

Copy link
Copy Markdown
Member

closing in favor of #15825.

@josevalim josevalim closed this Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

failing parameterized tests may not be retried by mix test --failed

2 participants